{
  "properties" : { },
  "id" : "624f3e3431af470bb3768eba1041bbcb",
  "script" : null,
  "groupId" : "8072991b1c194fb08fdf8da03cd8c54b",
  "name" : "新建巡检任务",
  "createTime" : 1727071089187,
  "updateTime" : 1726296278137,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "save",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": \"1834840226895605760\"\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "root",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "createUser",
      "value" : "admin",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "taskExecuteTime",
      "value" : "2024-08-05 00:00:00",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "taskExecuteType",
      "value" : "0",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "taskName",
      "value" : "1tes",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "taskTimeFrame",
      "value" : "1",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "500",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "success",
      "value" : "false",
      "description" : "",
      "required" : false,
      "dataType" : "Boolean",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "msg",
      "value" : "系统维护中，请稍后重试。",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : "",
      "defaultValue" : "",
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import java.sql.Timestamp;
// import cn.hutool.core.date.DateUtil;
import com.kd.ndmp.util.DateUtil


Timestamp taskExecuteTime= body.taskExecuteTime == null?new Timestamp(System.currentTimeMillis()) :  Timestamp.valueOf(body.taskExecuteTime)
 
 
int frame = body.taskTimeFrame == null ? 1 : body.taskTimeFrame;
Timestamp next;
if (frame == 1) { // 年为周期
    next = new Timestamp(DateUtil.getNextYear(new Date(taskExecuteTime.getTime()), 1).getTime());
} else if (frame == 2) { // 季度为周期
    next = new Timestamp(DateUtil.getNextMonth(new Date(taskExecuteTime.getTime()), 3).getTime());
} else { // 月为周期
    next = new Timestamp(DateUtil.getNextMonth(new Date(taskExecuteTime.getTime()), 1).getTime());
}
body.taskExecuteNextTime = taskExecuteTime.time > System.currentTimeMillis() ? taskExecuteTime : next;


var id=IdUtil.getSnowflakeNextId()
db.insert(""" 
insert into  ndmp_audit_task(id,create_user,task_execute_time,task_execute_type,task_name,task_time_frame)  
 values (#{id},#{body.createUser},#{body.taskExecuteTime},#{body.taskExecuteType},#{body.taskName},#{body.taskTimeFrame})

""")



return id